#ifndef EVENTCLIENT_H
#define EVENTCLIENT_H
#include <QDebug>
#include <grpcpp/grpcpp.h>

#include "grpcevent.grpc.pb.h"

#include <grpc/grpc.h>
#include <grpcpp/alarm.h>
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
#include <grpcpp/create_channel.h>
#include <grpcpp/security/credentials.h>

using grpc::Channel;
using grpc::ClientContext;
using grpc::ClientReader;
using grpc::ClientReaderWriter;
using grpc::ClientWriter;
using grpc::Status;
using Evol::Common::Grpc::Server::GrpcEvent;
using Evol::Common::Grpc::Server::GrpcEventMessage;

class EventClient {
public:
    EventClient(std::shared_ptr<Channel> channel)
        : stub_(GrpcEvent::NewStub(channel)) {}

    // Assembles the client's payload, sends it and presents the response back
    // from the server.
    std::string Dispatch(const std::string& text) ;

    void SubDispatch();
private:
    std::unique_ptr<GrpcEvent::Stub> stub_;
};

void EventClientTest();

#endif // EVENTCLIENT_H
